#include "parser.h"
#include <iostream>

using namespace std;

int main()
{
	string str = "This is    testing";
	Parser parser;

	cout << str << "\nNumField is " << parser.numField(str) << endl;
	cout << parser.getField(str,2) << endl;

	string substr = "parser";
	parser.addField(str,substr,3);
	cout << str << "\nNumField is " << parser.numField(str) << endl;

	str = "1,2,3,4";
	parser.setDelemiter(',');
	cout << str << "\nNumField is " << parser.numField(str) << endl;
	int i;
	for (i = 0; i < parser.numField(str);i++){
		cout << parser.getField(str,i) << " ";
	}
	cout << endl;

	substr = "5";
	parser.addField(str,substr,i);
	cout << str << "\nNumField is " << parser.numField(str) << endl;

	parser.addField(str,substr,2);
	cout << str << "\nNumField is " << parser.numField(str) << endl;

	return 0;
}

